import { http } from "@/utils";

//1.获取所有频道
export const getChannelAPI=()=>{
    return http({
        url:'/channels',
        method:'GET'
    })
}

//2.新增文章列表
export const addArticleAPI=(data)=>{
    return http({
        url:'/mp/articles?draft=false',
        method:'POST',
        data
    })
}

//3.获取文章列表
export const getArticleAPI=(params)=>{
    return http({
        url:'/mp/articles',
        method:'GET',
        params
    })
}

//4.删除文章
export const delArticle=(id)=>{
    return http({
        url:`/mp/articles/${id}`,
        method:'DELETE'
    })
}

//5.获取文章详情
export const getArticleDetail=(id)=>{
    return http({
        url:`/mp/articles/${id}`,
        method:'GET'
    })
}

//编辑文章
export const putArticleAPI=(data)=>{
    return http({
        url:`/mp/articles/${data.id}?draft=false`,
        method:'PUT',
        data
    })
}